package com.gwnet.shop.service.impl;

import com.gwnet.common.core.utils.DateUtils;
import com.gwnet.shop.domain.ShopAddress;
import com.gwnet.shop.mapper.ShopAddressMapper;
import com.gwnet.shop.service.IShopAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * 收货地址Service业务层处理
 * 
 * @author 张万鹏
 * @date 2024-07-22
 */
@Service
public class ShopAddressServiceImpl implements IShopAddressService 
{
    @Resource
    private ShopAddressMapper shopAddressMapper;

    /**
     * 查询收货地址
     * 
     * @param id 收货地址主键
     * @return 收货地址
     */
    @Override
    public ShopAddress selectShopAddressById(Long id)
    {
        return shopAddressMapper.selectShopAddressById(id);
    }

    /**
     * 查询收货地址列表
     * 
     * @param memberAddress 收货地址
     * @return 收货地址
     */
    @Override
    public List<ShopAddress> selectShopAddressList(ShopAddress memberAddress)
    {
        return shopAddressMapper.selectShopAddressList(memberAddress);
    }

    /**
     * 新增收货地址
     * 
     * @param memberAddress 收货地址
     * @return 结果
     */
    @Override
    public int insertShopAddress(ShopAddress memberAddress)
    {
        memberAddress.setCreateTime(DateUtils.getNowDate());
        return shopAddressMapper.insertShopAddress(memberAddress);
    }

    /**
     * 修改收货地址
     * 
     * @param memberAddress 收货地址
     * @return 结果
     */
    @Override
    public int updateShopAddress(ShopAddress memberAddress)
    {
        memberAddress.setUpdateTime(DateUtils.getNowDate());
        return shopAddressMapper.updateShopAddress(memberAddress);
    }

    /**
     * 批量删除收货地址
     * 
     * @param ids 需要删除的收货地址主键
     * @return 结果
     */
    @Override
    public int deleteShopAddressByIds(Long[] ids)
    {
        return shopAddressMapper.deleteShopAddressByIds(ids);
    }

    /**
     * 删除收货地址信息
     * 
     * @param id 收货地址主键
     * @return 结果
     */
    @Override
    public int deleteShopAddressById(Long id)
    {
        return shopAddressMapper.deleteShopAddressById(id);
    }
}
